# Contributor: Thomas Kienlen <kommander@laposte.net>
# Maintainer: Thomas Kienlen <kommander@laposte.net>
pkgname=udpt
pkgver=3.1.2
pkgrel=0
pkgdesc="Lightweight UDP torrent tracker"
url="https://github.com/naim94a/udpt"
# loongarch64: blocked by libc crate
arch="all !loongarch64"
license="MIT"
makedepends="cargo cargo-auditable"
pkgusers="udpt"
pkggroups="udpt"
install="udpt.pre-install"
subpackages="$pkgname-openrc"
source="https://github.com/naim94a/udpt/archive/refs/tags/v$pkgver/udpt-$pkgver.tar.gz
	lock.patch
	udpt.initd
	udpt.conf
	"

prepare() {
	default_prepare
	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	cargo test --frozen
}

package() {
	install -D -m 755 target/release/udpt-rs "$pkgdir/usr/bin/udpt"
	install -D -m 755 "$srcdir/udpt.initd" "$pkgdir/etc/init.d/udpt"
	install -D -m 660 -o udpt -g udpt "$srcdir/udpt.conf" "$pkgdir/etc/udpt.conf"
}

sha512sums="
de0d715a87be3568448c61ae9b6484c4b9ad5863d956119ed80b3e821135208f59ca0a06dfa027b501dae51596d30f8f4ea81aba235f1f8464c77b9acc49e909  udpt-3.1.2.tar.gz
b28ecc070fe27b7d71fa8812f5dc7412c1bbd28bbc160028fb8abf65c6408bbd39d416aa931ef41dd1733d9f92a54172e41b6083a8ed5ac996b2bb557e979f84  lock.patch
e233e4d76a0ad458579810ebb9d5697604bfebb0f51f218bcd27ceff55d2a86c50bc28b278da6793f6e688492eb962043f1e876852b3d8dcec046bff56abe78b  udpt.initd
9646e424a2fe4355745241ce84f989453bf75b26bad772d2ba7e72eade6b51d5f8d4b6e3eb671edff3c892a47dda029a3aed93276a3a4f992db13cce57e1521d  udpt.conf
"
